import service from "@/api/index.js";

const orderApi = {
    //添加
    insert(orderVo){
        return service.post('/order',orderVo);
    },
    //删除
    delete(id){
        return service.delete(`/order/${id}`);
    },
    //修改
    update(order){
        return service.put('/order',order);
    },
    //分页搜索
    selectByCondition(condition, pageNum, pageSize){
        condition.pageNum=pageNum;
        condition.pageSize=pageSize;
        return service.get('/order/search',{params:condition});
    },
    //ID查询
    selectById(orderId){
        return service.get(`/order/${orderId}`);
    },
    pay(orderVo) {
        return service.post("/order/pay", orderVo);
    },//根据用户id查询
    selectByUserId(pageNum, pageSize) {
        return service.get("/order/user", {
            params: {
                pageNum,
                pageSize
            }
        });
    },
    //获取省份及订单量
    getProCount() {
        return service.get("/order/proCount");
    },
    //确认收发货
    shipping(order) {
        return service.put("/order/shipping",order);
    }
}

export default orderApi;